package com.sziit.se.highconcurrency.product.application.service.impl;


import com.sziit.se.highconcurrency.product.application.entity.Product;
import com.sziit.se.highconcurrency.product.application.mapper.ProductMapper;
import com.sziit.se.highconcurrency.product.application.service.IProductService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Base64;
import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author dongchunkeng
 * @since 2022-11-08
 */
@Service
@AllArgsConstructor
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements IProductService {
    private final ProductMapper productMapper;

    @Override
    public List<Product> getAllData() {
        return productMapper.getAllData();
    }

    @Override
    public Boolean insertProduct(String productId, String productName, int inventory, float price, byte[] image) {
        return productMapper.insertProduct(productId, productName, inventory, price, image);
    }

    @Override
    public Product getOneData(String productId) {
        return productMapper.getOneData(productId);
    }

    @Override
    public Boolean updateOneDate(Product product) {
        return productMapper.updateByProductId(product);
    }

    @Override
    public List<Product> queryProductByPage(String productName, Float price, Integer index, Integer pageSize) {

        return productMapper.queryProductByPage(productName, price, index, pageSize);
    }

    @Override
    public Integer selectCount(String productName, Float price) {
        return productMapper.selectCount(productName,price);
    }


}
